package COSC455Compiler;

public class MySemanticAnalyzer {

    String htmlTok = "";

    public void determine() {
        if (LexicalTokens.SingleWord.contains(MyCompiler.token.toUpperCase())
                || LexicalTokens.DoubleWord.contains(MyCompiler.token.toUpperCase())
                || LexicalTokens.TripleWord.contains(MyCompiler.token.toUpperCase())) {

            if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Doc_Begin)) {
                htmlTok = "<html>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Comment_Begin)) {
                htmlTok = "<!--";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Head_Begin)) {
                htmlTok = "<head>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Title_Begin)) {
                htmlTok = "<title>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Paragraph_Begin)) {
                htmlTok = "<p>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Variable_Begin)) {
                htmlTok = "<var>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Its)) {
                htmlTok = "=";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Bold_Begin)) {
                htmlTok = "<b>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Italics_Begin)) {
                htmlTok = "<i>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.List_Begin)) {
                htmlTok = "<ul>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Item_Begin)) {
                htmlTok = "<li>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Audio_Begin)) {
                htmlTok = "<audio controls> <source src=\"";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Video_Begin)) {
                htmlTok = "<iframe src=\"";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.NewLine_Begin)) {
                htmlTok = "<br>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } 
            
            //else if(MyCompiler.token.toUpperCase().equalsIgnoreCase("#VISIBLE")){
            //htmlTok = "<var>";
            //MyCompiler.HTMLOutput.add(htmlTok);
            //}
            
            //End Tags
            else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Doc_End)) {
                htmlTok = "</html>";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.toUpperCase().equalsIgnoreCase(LexicalTokens.Comment_END)) {
                htmlTok = "-->";
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.equalsIgnoreCase(LexicalTokens.MKAY)) {
                htmlTok = ParseTrees.getTag(LexicalTokens.MKAY);
                MyCompiler.HTMLOutput.add(htmlTok);
            } else if (MyCompiler.token.equalsIgnoreCase(LexicalTokens.OIC)) {
                htmlTok = ParseTrees.getTag(LexicalTokens.OIC);
                MyCompiler.HTMLOutput.add(htmlTok);
            }
        } else {
            htmlTok = MyCompiler.token;
            MyCompiler.HTMLOutput.add(htmlTok);
        }
    }
}
